
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"><meta name="format-detection" content="telephone=no">
    <title>机构设置</title>
    <link rel="stylesheet" href="${root}assets/agile/css/agile.layout.css">
<link rel="stylesheet" href="${root}assets/third/seedsui/plugin/seedsui/seedsui.min.css">
</head>

<body>
<div id="section_container">
    <section data-role="section" id="page_form_validate" class="active">
        <header>
            <div class="titlebar">
                <a data-toggle="back" href="#"><i class="icon icon-arrowleft"></i></a>
                <h1>机构设置</h1>
            </div>
        </header>
        <article id="main_article" data-role="article" class="active">
        	<form id="form1" action="${root}html/organ/update_organ/1" method="post" enctype='multipart/form-data'>
        	<input type="hidden" value="${obj.id}" name="id" />
        	<input type="hidden" value="organ/menu" name="_httpurl" />
        	<input type="hidden" value="organ" name=".table" />
                <div class="group">
                    <div class="row">
                        <label class="row-left">机构名称</label>
                        <div class="row-right input-box" data-input="clear">
                            <input type="text" placeholder="用户名" name="name" value="${obj.name!}" data-rule-field="用户名" data-rule="name">
                            <i class="icon icon-clear-fill color-placeholder" style="display: none;"></i>
                        </div>
                    </div>
                    <div class="row">
                        <label class="row-left">负责人</label>
                        <div class="row-right input-box" data-input="clear">
                            <input type="text" placeholder="${session.user.name!}(修改联系心教育)" readonly data-rule-field="name" data-rule="username">
                            <i class="icon icon-clear-fill color-placeholder" style="display: none;"></i>
                        </div>
                    </div>
                    <div class="row">
                        <label class="row-left">联系电话</label>
                        <div class="row-right input-box" data-input="clear">
                            <input type="text" placeholder="未填写" name="phone" value="${obj.phone!}" data-rule-field="phone" data-rule="phone">
                            <i class="icon icon-clear-fill color-placeholder" style="display: none;"></i>
                        </div>
                    </div>
                    <div class="row">
                        <label class="row-left">地址</label>
                        <div class="row-right input-box">
                            <input type="text" name="addr" placeholder="${obj.addr!}" value="${obj.addr}" data-rule-field="addr" data-rule="addr">
                        </div>
                    </div>
                    <div class="group">
                    <div class="row">
                <label>图片上传</label>
                <div class="input-box margin8">
                    <input type="file" name="img" id="takePicture" accept="image/*" value="${obj.img}" multiple />
                </div>
            </div>
        	<div class="row">
        	<div class="sliver">上传的图片</div>
            <ul class="grid album" data-col="3" >
            <li><img id="photoshow" src="/${obj.img!}" style="width: 80px;height: 80px;" /></li>
            </ul>
            </div>
                    <div class="row">
                        <label class="row-left">未付款订单提醒</label>
                        <div class="row-right input-text lineheight0 noborder">
                            <div class="switch ${decode(obj.tx,1,'active','')}" data-role="toggle " data-on="是" data-off="否" data-on-value="1" data-off-value="0" data-name="tx">
                            	<div class="switch-handle"></div>
                            </div><input type="hidden" name="tx" value="${obj.tx!1}">
                        </div>
                    </div>
                </div>
                    <button class="radius4 button block margin8" style="width: 96%;">保存设置</button>
                </div>
            </form>
        </article>
    </section>
</div>
<!--- third -->
	<script src="${root}assets/third/jquery/jquery-2.1.3.min.js"></script>
	<script src="${root}assets/third/jquery/jquery.mobile.custom.min.js"></script>
	<!---  agile -->
	<script type="text/javascript" src="${root}assets/agile/js/agile.js"></script>
<script type="text/javascript" src="${root}assets/bridge/exmobi.js"></script>
<script type="text/javascript" src="${root}assets/bridge/agile.exmobi.js"></script>			
	<!-- app -->
	<script type="text/javascript" src="${root}assets/app/js/app.seedsui.js"></script>
	<script type="text/javascript" src="${root}assets/third/seedsui/plugin/seedsui/seedsui.min.js"></script>
 
    <script>
    window.addEventListener("load",function(){
        var f=new Form("#form1");
        f.container.addEventListener("submit",function(e){
            //e.preventDefault();
            //f.validate();
        },false);
    },false);
    function fileSelect(fileId,handler){
    	var takePicture=document.querySelector(fileId);
        //监听上传控件事件
        takePicture.onchange = function (e) {
            var files = event.target.files;
            var filepath=null;
            for(var i=0,file;file=files[i++];){
                try {
                    var URL = window.URL || window.webkitURL;
                    filePath = URL.createObjectURL(file);
                    handler(filePath);
                    URL.revokeObjectURL(filePath);
                }
                catch (e) {
                    try {
                        var fileReader = new FileReader();
                        fileReader.onload = function (event) {
                            filePath= event.target.result;
                            handler(filePath);
                        };
                        fileReader.readAsDataURL(file);
                    }
                    catch (e) {
                        alert("此设备即不支持createObjectURL也不支持FileReader");
                    }
                }
            }
        };
    };
    fileSelect("#takePicture",function(path){
        if(path){
    	   $("#photoshow").attr('src',path);
        }
    });
    
    </script>
</body>
</html>
